<template>
    <div class="container">
        <label class="label">请输入您要查看的学生的学号</label>
        <el-input v-model="input" style="width: 240px" placeholder="请输入学号" @keyup.enter="handleEnter" />
        <span style="margin: 20px;">回车查看网站</span>
        <div v-if="flag == 1">
            <el-link :href="web" target="_blank" type="primary" class="web">{{ input }}学生端网站链接</el-link>
        </div>
    </div>
</template>

<script setup>
import { getWebSite } from '@/api/classReport/readReport'
import { ref } from 'vue';
const name = "StudentFrontWeb"
const web = ref("")
const input = ref("")
const flag = ref(0)
function Info() {
    getWebSite().then(res => {
        if (res.code == 200) {
            const data = res.rows
            data.forEach(element => {
                if (element.type == name) {
                    web.value = JSON.parse(element.scoreRanges)
                    // console.log(web.value);
                }
            });
        }
    })
}

function handleEnter() {
    flag.value = 1
    localStorage.setItem("StudentId", input.value)
}
Info()

</script>

<style scoped>
.container {
    margin: 20px;
}

.web {
    font-size: 20px;
    margin-top: 20px;
}

.label {
    margin-right: 10px;
}
</style>